﻿Ext.define ('rangoaqui.view.phone.Login', 
{
		extend: 'Ext.form.Panel',
		alias: 'widget.loginForm',
		requires: [
			'Ext.form.FieldSet', 'Ext.Label', 'Ext.Img'			
		],
		baseCls:'',
		cls: 'login-bg',
		config: 
			{
				title: 'Login',
				layout: 
				{
					type: 'vbox',
					pack : 'center' 
				},
				items: 
					[
							{
								// TODO: utilizar logos de dimensoes diferentes futuramente
								style: "text-align: center",
								html:  "<img src='resources/img/novalogo.png' style='max-width: 190px'/>",
								
							},
											
							{
								xtype: 'fieldset',
								width: '15em',
								style: 'margin: auto; margin-top: 6px',
								items: 
									[
										{
											xtype: 'textfield',
											placeHolder: 'Insira aqui seu usuario...',
											itemId: 'userTextField',
											name: 'userTextField',
											cls: 'laranja_fraco'
										},
										{
											xtype: 'passwordfield',
											placeHolder: 'e aqui vai a senha',
											itemId: 'pwdTextField',
											name: 'pwdTextField',
											cls: 'laranja_fraco'
										}
										
									]
							},
							{
											xtype: 'button',
											itemId: 'loginButton',
											action: 'doLogin',
											ui: 'action',
											padding: '20px',
											width: '15em',
											style: 'margin: auto; margin-top: 6px',
											text: 'Entrar!'
										},
										
							/*
							{
											xtype: 'panel',
											height:'30px',
											style:'background-collor: #f7f7f7;text-align: center;margin-top:5px',
											html: "<div class='laranja_forte' style='font-size: 22px;'><span>ou</span></div>"
							},*/
							/*
							{
								xtype: 'button',
								itemId: 'fbLoginButton',
								action: 'doLogin',
								ui: 'facebook',
								padding: '20px',
								width: '15em',
								style: 'margin: auto; margin-top: 3px',
								text: 'Acesse com o Facebook!'
							},
							*/
							{
											xtype: 'panel',
											height:'30px',
											style:'background-collor: #f7f7f7;text-align: center;margin-top:25px',
											html: "<div class='laranja_forte' style='font-size: 12px;'><a class='esqueceuSenha' style='text-decoration:underline'>Esqueceu a senha?</a><span> Ou</span><a class='novoUsuario' style='text-decoration:underline'> não tem cadastro?</a></div>",
											listeners: {
											scope: this,
										//	itemtap: this.onItemtapAction,
											tap: {
											   element: 'element',
											   fn: function (e) { 
												  if (e.getTarget('a.novoUsuario')) {
												 	  var homeController = rangoaqui.app.getController('phone.HomeController');
													  homeController.showEditUser();
												  }
												  if (e.getTarget('a.esqueceuSenha')) {
													  var homeController = rangoaqui.app.getController('phone.HomeController');
													  homeController.showEsqSenha();
												  }
												}
											}
}
						}
							
					]
					
					
				
			}
});